# eric7.Preferences.PreferencesLexer

Module implementing a special QScintilla lexer to handle the preferences.

### Global Attributes

None

### Classes

PreferencesLexer | Class implementing a Lexer facade for the highlighting styles configuration.
PreferencesLexerError | Class defining a special error for the PreferencesLexer class.
PreferencesLexerLanguageError | Class defining a special error for the PreferencesLexer class.

### Functions

None

## PreferencesLexer

Class implementing a Lexer facade for the highlighting styles configuration.

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

PreferencesLexer | Constructor
addSubstyle | Public method to add an empty sub-style to a given style.
color | Public method to get the color of a style.
defaultColor | Public method to get the default color of a style.
defaultDescription | Public method to get the default descriptive string for a style.
defaultEolFill | Public method to get the default eolFill flag for a style.
defaultFont | Public method to get the default font for a style.
defaultPaper | Public method to get the default background for a style.
defaultWords | Public method to get the default list of words for a style.
delSubstyle | Public method to delete a given sub-style definition.
description | Public method to get a descriptive string for a style.
eolFill | Public method to get the eolFill flag for a style.
font | Public method to get the font for a style.
getStyles | Public method to get a list of all supported styles.
getSubStyles | Public method to get a list of all sub-styles of a style.
hasStyle | Public method to test for a given style definition.
isBaseStyle | Public method to test, if a given style may have sub-styles.
language | Public method to get the lexers programming language.
loadDefaultSubStyles | Public method to load the default sub-styles for a given base style.
paper | Public method to get the background for a style.
setColor | Public method to set the color for a style.
setDescription | Public method to set a descriptive string for a style.
setEolFill | Public method to set the eolFill flag for a style.
setFont | Public method to set the font for a style.
setPaper | Public method to set the background for a style.
setWords | Public method to set the list of words for a style.
words | Public method to get the list of words for a style.
writeSettings | Public method to write the lexer settings.

### Static Methods

None

#### PreferencesLexer (Constructor)

PreferencesLexer(language, parent=None)

Constructor

language (str)
  language of the lexer
parent (QWidget)
  parent widget of this lexer

Raises PreferencesLexerLanguageError:
  raised to indicate an invalid lexer language

#### PreferencesLexer.addSubstyle

addSubstyle(style)

Public method to add an empty sub-style to a given style.

style (int)
  style number

Return:
  allocated sub-style number or -1 to indicate an error

Return Type:
  int

#### PreferencesLexer.color

color(style, substyle=-1)

Public method to get the color of a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  color

Return Type:
  QColor

#### PreferencesLexer.defaultColor

defaultColor(style, substyle=-1)

Public method to get the default color of a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  default color

Return Type:
  QColor

#### PreferencesLexer.defaultDescription

defaultDescription(style, substyle=-1)

Public method to get the default descriptive string for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  default description of the style

Return Type:
  str

#### PreferencesLexer.defaultEolFill

defaultEolFill(style, substyle=-1)

Public method to get the default eolFill flag for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  default eolFill flag

Return Type:
  bool

#### PreferencesLexer.defaultFont

defaultFont(style, substyle=-1)

Public method to get the default font for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  default font

Return Type:
  QFont

#### PreferencesLexer.defaultPaper

defaultPaper(style, substyle=-1)

Public method to get the default background for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  default background color

Return Type:
  QColor

#### PreferencesLexer.defaultWords

defaultWords(style, substyle=-1)

Public method to get the default list of words for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  whitespace separated default list of words

Return Type:
  str

#### PreferencesLexer.delSubstyle

delSubstyle(style, substyle)

Public method to delete a given sub-style definition.

style (int)
  base style number
substyle (int)
  sub-style number

Return:
  flag indicating successful deletion

Return Type:
  bool

#### PreferencesLexer.description

description(style, substyle=-1)

Public method to get a descriptive string for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  description of the style

Return Type:
  str

#### PreferencesLexer.eolFill

eolFill(style, substyle=-1)

Public method to get the eolFill flag for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  eolFill flag

Return Type:
  bool

#### PreferencesLexer.font

font(style, substyle=-1)

Public method to get the font for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  font

Return Type:
  QFont

#### PreferencesLexer.getStyles

getStyles()

Public method to get a list of all supported styles.

Return:
  list of tuples each containing the description of the style, style number and sub-style number (or -1 for no sub-style)

Return Type:
  list of tuples of (str, int, int)

#### PreferencesLexer.getSubStyles

getSubStyles(style)

Public method to get a list of all sub-styles of a style.

style (int)
  style number

Return:
  list of tuples each containing the description of the style, style number and sub-style number (or -1 for no sub-style)

Return Type:
  list of tuples of (str, int, int)

#### PreferencesLexer.hasStyle

hasStyle(style, substyle)

Public method to test for a given style definition.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  flag indicating the existence of a style definition

Return Type:
  bool

#### PreferencesLexer.isBaseStyle

isBaseStyle(style)

Public method to test, if a given style may have sub-styles.

style (int)
  base style number

Return:
  flag indicating that the style may have sub-styles

Return Type:
  bool

#### PreferencesLexer.language

language()

Public method to get the lexers programming language.

Return:
  lexer programming language

Return Type:
  str

#### PreferencesLexer.loadDefaultSubStyles

loadDefaultSubStyles(style)

Public method to load the default sub-styles for a given base style.

style (int)
  style number

#### PreferencesLexer.paper

paper(style, substyle=-1)

Public method to get the background for a style.

style (int)
  the style number
substyle (int)
  sub-style number

Return:
  background color

Return Type:
  QColor

#### PreferencesLexer.setColor

setColor(c, style, substyle=-1)

Public method to set the color for a style.

c (QColor)
  color
style (int)
  style number
substyle (int)
  sub-style number

#### PreferencesLexer.setDescription

setDescription(description, style, substyle=-1)

Public method to set a descriptive string for a style.

description (str)
  description for the style
style (int)
  style number
substyle (int)
  sub-style number

#### PreferencesLexer.setEolFill

setEolFill(eolfill, style, substyle=-1)

Public method to set the eolFill flag for a style.

eolfill (bool)
  eolFill flag
style (int)
  style number
substyle (int)
  sub-style number

#### PreferencesLexer.setFont

setFont(f, style, substyle=-1)

Public method to set the font for a style.

f (QFont)
  font
style (int)
  style number
substyle (int)
  sub-style number

#### PreferencesLexer.setPaper

setPaper(c, style, substyle=-1)

Public method to set the background for a style.

c (QColor)
  background color
style (int)
  style number
substyle (int)
  sub-style number

#### PreferencesLexer.setWords

setWords(words, style, substyle=-1)

Public method to set the list of words for a style.

words (str)
  whitespace separated list of words
style (int)
  style number
substyle (int)
  sub-style number

#### PreferencesLexer.words

words(style, substyle=-1)

Public method to get the list of words for a style.

style (int)
  style number
substyle (int)
  sub-style number

Return:
  whitespace separated list of words

Return Type:
  str

#### PreferencesLexer.writeSettings

writeSettings()

Public method to write the lexer settings.

Up

## PreferencesLexerError

Class defining a special error for the PreferencesLexer class.

### Derived from

Exception

### Class Attributes

None

### Class Methods

None

### Methods

PreferencesLexerError | Constructor
__repr__ | Special method returning a representation of the exception.
__str__ | Special method returning a string representation of the exception.

### Static Methods

None

#### PreferencesLexerError (Constructor)

PreferencesLexerError()

Constructor

#### PreferencesLexerError.__repr__

__repr__()

Special method returning a representation of the exception.

Return:
  string representing the error message

Return Type:
  str

#### PreferencesLexerError.__str__

__str__()

Special method returning a string representation of the exception.

Return:
  string representing the error message

Return Type:
  str

Up

## PreferencesLexerLanguageError

Class defining a special error for the PreferencesLexer class.

### Derived from

PreferencesLexerError

### Class Attributes

None

### Class Methods

None

### Methods

PreferencesLexerLanguageError | Constructor

### Static Methods

None

#### PreferencesLexerLanguageError (Constructor)

PreferencesLexerLanguageError(language)

Constructor

language (str)
  lexer language

Up